<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="../resources/js/jquery-1.7.2.min.js"></script>
<script src="res/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="res/My97DatePicker/skin/WdatePicker.css">
<script type="text/javascript">
//var jsonserver="http://192.168.37.116:8089/mobile-html5-rest/";	
var jsonserver="http://bi.911860.com/mobile-html5-rest/";
$(document).ready(function(e) {
	
    $("#queryBtn").click(function(){
		var dataArray=$("#releasedate").val().split("-");
		$("#dateshow").text(dataArray[0]+"年"+dataArray[1]+"月"+dataArray[2]+"日");
		var u1=jsonserver+"/util/pv/"+$("#releasedate").val();
		
		$.getJSON(u1+".jsonp?callback=?",{},function(data){
			//alert(data);
			$("#datatab1").children().remove();
			$("#datatab1").append("<caption>页面点击量</caption>");
			var trHeaderObj=$("<tr style='color:green; font-size:20px;'>");
			
			var tdHeader="<td>页面名称</td><td>PV（自然天内页面点击量）</td>";
			trHeaderObj.append(tdHeader);
			trHeaderObj.appendTo($("#datatab1"));
			if(data.lcb.length>0){
			$.each(data.lcb,function(i,items){
				
					var trObj=$("<tr>");
					var tdText="<td>"+items.pageName+"</td><td>"+items.pageCount+"</td>";
					trObj.append(tdText);
					trObj.appendTo($("#datatab1"));
				});
			}else{
				var trnull=$("<tr>");
				var tdnull="<td style='color:red' align='center' colspan='2'>无记录</td>";
				trnull.append(tdnull);
				trnull.appendTo($("#datatab1"));
			}
			});	
		var vu=jsonserver+"/util/uv/"+$("#releasedate").val();
		$.getJSON(vu+".jsonp?callback=?",{},function(data){
			$("#datatabuv").children().remove();
			$("#datatabuv").append("<caption>UV（自然天内页面访问IP数）</caption>");
			var uvTr=$("<tr style='color:#01FFFF;font-weight:bolder;'><td >UV总量</td><td>"+data+"</td></tr>");
			uvTr.appendTo($("#datatabuv"));
		});
		var u2=jsonserver+"/util/btn/"+$("#releasedate").val();
		
		$.getJSON(u2+".jsonp?callback=?",{},function(data){
			//alert(data);
			$("#datatab2").children().remove();
			$("#datatab2").append("<caption>相关按钮点击量</caption>>");
			var trHeaderObj=$("<tr style=' color:green;font-size:20px;'>");
			var tdHeader="<td>按钮名称</td><td>PV（自然天内页面点击量）</td>";
			trHeaderObj.append(tdHeader);
			trHeaderObj.appendTo($("#datatab2"));
			if(data.lbcbList.length>0){
				$.each(data.lbcbList,function(i,items){
					
						var trObj=$("<tr>");
						var tdText="<td>"+items.buttonName+"</td><td>"+items.buttonCount+"</td>";
						trObj.append(tdText);
						trObj.appendTo($("#datatab2"));
				});
			}else{
				var trnull=$("<tr>");
				var tdnull="<td style='color:red' align='center' colspan='2'>无记录</td>";
				trnull.append(tdnull);
				trnull.appendTo($("#datatab2"));
			}
			});	
	});
});
</script>
<style type="text/css">
	table{
	border-collapse:collapse;
}
table td{
	border:#000 solid 1px;
	border-collapse:collapse;
	width:50%;
}
caption{
	font-size:26px;
}

</style>
</head>

<body>
<div style="margin:0px auto;">
 请选择查询日期:<input type="text" id="releasedate" class="Wdate" onClick="WdatePicker()" readonly/>
    <button id="queryBtn">查询</button>
   </div>
   	<table id="datatab1" width="80%" style=" text-align:center;" align="center">
    
    </table>
	<table id="datatabuv" width="80%" style=" text-align:center;" align="center">
		
    </table>
    <table id="datatab2" width="80%" style=" text-align:center;" align="center">
    
    </table>
    <div style="text-align:right; font-size:22px; font-weight:bold; font-family:'黑体'; padding-right:10%; padding-top:30px;" id="dateshow"></div>
</body>
</html>
